/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package utils;

import exceptions.DadosIncorretosException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import validators.ValidatorError;

/**
 *
 * @author arruda
 */
public class StringParaData {
    public static GregorianCalendar converter(String dataStr) throws ValidatorError{
        
        SimpleDateFormat formData = new SimpleDateFormat("dd/MM/yyyy");
        formData.setLenient(false);
        Calendar date = GregorianCalendar.getInstance();
        try {
            date.setTime((Date)formData.parse(dataStr));
        }
        catch (ParseException ex) {
            throw new ValidatorError("Formatacao de Data Invalida");
        }
        return (GregorianCalendar) date;
    }
    
}
